|
|
|
|
|
|
|
Declaring a Global Compiler Constant |
|
|
|
|
|
|
|
|
To declare a public compiler constant (one that will be available to your entire application), you need to go to the Tools, Options menu and select the Advanced tab as shown in Figure 8.1. |
|
|
|
|
|
|
|
|
Figure 8.1
The Project Properties window. |
|
|
|
|
|
|
|
|
In the Conditional Compilation text box, enter the constant name, an equal sign, and the value to assign. When you create the constant name, it must follow the naming rules for a Visual Basic variable. The value you assign to the constant can only be a numeric value. You can place multiple values in this text box by separating them with colons (:). Heres an example: |
|
|
|
 |
|
|
|
|
cconLANGUAGE = 0 : cconDEBUGCODE = -1 |
|
|
|
|
|
|
|
|
Declaring a Module-level Compiler Constant |
|
|
|
|
|
|
|
|
You can declare compiler constants in the General Declarations section of a module. However, the compiler constants you define here have scope only within that module. Heres an example: |
|
|
|
 |
|
|
|
|
' General Declarations Section
Option Explicit
#Const cconLANGUAGE = 0 |
|
|
|
|
|